package com.homegoods.classify.ui.fragment;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.fastjson.JSON;
import com.homegoods.aroutercomment.ARouterPath;
import com.homegoods.classify.R;
import com.homegoods.classify.adapter.ZPBrandAdapter;
import com.homegoods.classify.databinding.ClassifyZpFragmentBrandBinding;
import com.homegoods.classify.model.ClassifyModel;
import com.kedll.library.fragment.KBaseFragment;
import com.kedll.library.mvp.BasePresenter;

/**
 * add shibo.zheng
 * 19/06/19
 * 品牌界面fragment
 */

@Route(path = ARouterPath.PATH_ZP_CLASSIFY_BRAND)
public class ZPBrandFragment extends KBaseFragment<ClassifyZpFragmentBrandBinding, BasePresenter> {
    private RecyclerView brandParentList;
    @Autowired(name = "models")
    public ClassifyModel classifyModel;

    @Override
    protected void initEvent(Bundle savedInstanceState) {
        ARouter.getInstance().inject(this);
        brandParentList = mBinding.brandParentList;
        brandParentList.setLayoutManager(new LinearLayoutManager(getContext()));
        Log.d(TAG, "initEvent: classifyModel ZPBrandFragment == " + JSON.toJSONString(classifyModel));
        ZPBrandAdapter adapter = new ZPBrandAdapter(getContext(), classifyModel.getBrandList());
        brandParentList.setAdapter(adapter);
    }

    @Override
    protected BasePresenter getPresenter() {
        return null;
    }

    @Override
    protected int getLayout() {
        return R.layout.classify_zp_fragment_brand;
    }
}
